<template>
  <d2-container>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column
        label="序号"
        type="index"
        align="center">
      </el-table-column>
      <el-table-column
        width=""
        label="用户ID"
        align="center"
        prop="user_id">
      </el-table-column>
      <el-table-column
        width=""
        label="旧旺旺号"
        align="center"
        prop="old_tb_name">
        <template slot-scope="scope">
            <span style="cursor: pointer;color:red;" :data-clipboard-text="scope.row.old_tb_name"
                  class="tag-read" @click="copy()">{{scope.row.old_tb_name}}</span>
        </template>
      </el-table-column>
      <el-table-column
        width=""
        label="新旺旺号"
        align="center"
        prop="tb_name">
        <template slot-scope="scope">
            <span style="cursor: pointer;color:red;" :data-clipboard-text="scope.row.tb_name"
                  class="tag-read" @click="copy()">{{scope.row.tb_name}}</span>
        </template>
      </el-table-column>
      <el-table-column
        width=""
        label="提交时间"
        align="center"
        prop="create_time">
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        align="center"
        width="">
        <template slot-scope="scope">
          <el-button @click="ExamineTbSuccesss(scope.row)" type="primary" size="mini" plain>通过</el-button>
          <el-button @click="Dialog = true;refuse_row = scope.row" type="danger" size="mini" plain>拒绝</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @current-change="handleCurrentChange"
      :current-page.sync="page"
      :page-size="20"
      layout="total, prev, pager, next"
      :total="count"
      style="text-align:right;margin:10px 0;">
    </el-pagination>
    <el-dialog
      title="拒绝理由"
      :visible.sync="Dialog"
      width="30%"
      center>
      <div style="display:flex;">
        <span>拒绝理由:</span>
        <el-select v-model="refuseing" allow-create clearable filterable placeholder="请选择拒绝理由">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </div>
      <br/>
      <el-button type="primary" @click="ExamineTbNos">确认</el-button>
      <el-button type="primary" @click="Dialog = false">取消</el-button>
    </el-dialog>
  </d2-container>
</template>

<script>
import {Brushhand_ExamineTbName,Brushhand_RefuseTbName,Brushhand_ApprovedTbName} from "@/api/sys.login";
import Clipboard from "clipboard";
export default {
  name: "index",
  data() {
    return {
      page:1,
      pageSize:10,
      tableData:[],
      count:"",
      refuse_row:[],
      refuseing:"",
      options:[
        {value: "心等级太低",label:"心等级太低"},
        {value: "周评价太高",label:"周评价太高"},
        {value: "差评号",label:"差评号"},
        {value: "降权号",label:"降权号"},
        {value: "旺旺不对",label:"旺旺不对"},
        {value: "低于一年号",label:"低于一年号"},
        {value: "手机号与身份证地址不否",label:"手机号与身份证地址不否"},
      ],
      Dialog:false,
    }
  },
  methods: {
    //通过
    ExamineTbSuccesss(row){
      let params = {
        id:row.id,
      }
      Brushhand_ApprovedTbName(params).then((res)=>{
        this.ExamineDylists()
      })
    },
    copy() {
      var clipboard = new Clipboard('.tag-read')
      clipboard.on('success', e => {
        this.$message.success("复制成功");//这里你如果引入了elementui的提示就可以用，没有就注释即可
        // 释放内存
        clipboard.destroy()
      })
      clipboard.on('error', e => {
        // 不支持复制
        console.log('该浏览器不支持自动复制')
        // 释放内存
        clipboard.destroy()
      })
    },
    //拒绝
    ExamineTbNos(){
      let params = {
        id:this.refuse_row.id,
        onte:this.refuseing,
      }
      Brushhand_RefuseTbName(params).then((res)=>{
        this.ExamineDylists()
        this.Dialog = false
      })
    },
    handleCurrentChange(val) {
      this.page = val
      this.ExamineDylists()
    },
    ExamineDylists() {
      let params = {
        page: this.page,
        pageSize: this.pageSize,
      }
      Brushhand_ExamineTbName(params).then((res) => {
        console.log(res.data);
        this.tableData = res.data
        this.count = res.count
      })
    }
  },
  created() {
    this.ExamineDylists()
  }
}
</script>

<style scoped>

</style>
